﻿@page "/closebutton"
@inject IModalDialogService ModalDialog

<h1>Hiding the modal close button</h1>

<hr class="mb-5" />

<p>
    Liquid Technologies Modal Dialog shows a close button in the modal by default. The button can be hidden if you
    prefer to handle closing the modal yourself.
</p>

<button @onclick="CloseButtonShown" class="btn btn-primary">Show the close button</button>
<button @onclick="CloseButtonHidden" class="btn btn-secondary">Hide the close button</button>

@code {

    void CloseButtonShown()
    {
        var parameters = new ModalDialogParameters();
        parameters.Add("FormId", 11);

        var options = new ModalDialogOptions() { ShowCloseButton = true };
        ModalDialog.ShowDialogAsync<SignUpForm>("Sign Up Form", options, parameters);
    }

    void CloseButtonHidden()
    {
        var parameters = new ModalDialogParameters();
        parameters.Add("FormId", 11);

        var options = new ModalDialogOptions() { ShowCloseButton = false };
        ModalDialog.ShowDialogAsync<SignUpForm>("Sign Up Form", options, parameters);
    }
}

